package com.dingding.sync.daas.config;

/**
 * @author: zhangyanan
 * @Date: 2020-05-04 13:17
 * @Description:
 */
//@Order(1)
//重点
//@WebFilter(filterName = "corsFilter", urlPatterns = {"/*"})
//public class CORSFilter implements Filter {

//    @Override
//    public void init(FilterConfig filterConfig) throws ServletException {
//        System.out.println("初始化filter==========================");
//    }
//    @Override
//    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
//        HttpServletResponse response = (HttpServletResponse) servletResponse;
//        response.setHeader("Access-Control-Allow-Origin", "http://localhost:3000"); //  这里最好明确的写允许的域名
//        response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE, PUT");
//        response.setHeader("Access-Control-Max-Age", "3600");
//        response.setHeader("Access-Control-Allow-Headers", "Content-Type,Access-Token,Authorization,ybg");
//        filterChain.doFilter(servletRequest, servletResponse);
//        System.out.println("filter==========================");
//    }
//    @Override
//    public void destroy() {
//        System.out.println("销毁filter==========================");
//    }
//}
